<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    /*设置flex布局*/
    /*默认消除对应的body的样式*/
    body{
        margin: 0;
        padding: 0;
    }
    /*设置box为flex布局*/
    .box{
        width: 500px;
        height: 400px;
        background-color: #f00;
        display: flex;/*设置为flex布局*/
        /*注意主轴和交叉周的概念*/
        flex-direction: row;/*默认就是这个值，主持周的方向*/
        flex-wrap: wrap;/*不够的时候换行*/
    }
    .box .item{
        width: 120px;
        height: 120px;
        background-color: rgb(0,255,0);
    }
</style>
<body>
    <!--了解flex布局-->
    <div class="box">
        <div class="item item1">1</div>
        <div class="item item2">2</div>
        <div class="item item3">3</div>
        <div class="item item4">4</div>
        <div class="item item5">5</div>
    </div>
</body>
</html>